home *** CD-ROM | disk | FTP | other *** search
- Path: admaix.sunydutchess.edu!ub!newserve!rebecca!rpi!not-for-mail
- From: cvjetko@PROBLEM_WITH_INEWS_GATEWAY_FILE.uni-erlangen.de (Miljenko Cvjetko)
- Newsgroups: comp.lang.c++,comp.lang.c++.moderated,comp.sys.hp.hpux
- Subject: [Q] gcc 2.7.2 + STL + HP_UX 9.05 = memory_leak ?
- Date: 25 Mar 1996 13:22:06 -0000
- Organization: Regionales Rechenzentrum Erlangen, Germany
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: kanze@lts.sel.alcatel.de
- Message-ID: <4j66lu$olu@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: 25 Mar 1996 12:12:48 GMT
-
- I was testing storing ptrs in STL container when I found
- out a memory-leak in STL implementation in following
- example:
-
- # include <list.h> // STL list
- # include <stdlib.h>
-
- class X
- {
- protected:
- list<int> nodes_; // this line causes
- // memory leak problems!!!
- // under HP_UX 9.05
- // not under Borland C/C++ + DOS
- };
-
- void f()
- {
- X x1;
- }
-
- int main()
- {
- memorymap(1);
- f();
- memorymap(1); // list is out of scope
- return 0;
- }
- - ------------------------------------------
- Result:
-
- arenastart : 0
- arenaend : 0
- # of blocks : 0
- # of free blocks : 0
- # of used blocks : 0
- # of smblk blks : 0
- total space used : 0
- space in free blocks : 0
- space in used blocks : 0
- space in smblk blocks : 0
- 1073748164: node block 8192
- 1073756356: free 1848
-
- arenastart : 1073748164
- arenaend : 1073758204
- # of blocks : 2
- # of free blocks : 1
- # of used blocks : 1
- # of smblk blks : 0
- total space used : 10040
- space in free blocks : 1848
- space in used blocks : 8192
- space in smblk blocks : 0
- - -------------------------------------------
- In addition, this code was compiled under
- BC 4.5 and had no memory leak! Am I
- misinterpreting memorymap() function call?
- Same was with some other containers (set,vector).
- Any suggestions?
-
- Thanx in advance
- Regards
- m.
-
-
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-